//
//  SQWorkDetailsTableViewCell.m
//  energy
//
//  Created by 周曼迪 on 2021/7/15.
//

#import "SQWorkDetailsTableViewCell.h"

#import "SQWorkDetailsModel.h"
#import "SQSpecialRegionModel.h"


@implementation SQWorkDetailsTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

+(CGFloat)cellHeight:(BaseModel *)model{
    return W(75);
    
}

-(void)setModel:(BaseModel<BaseCellModelProtocol> *)model{
    
    if ([model isKindOfClass:SQWorkDetailsModelData.class]) {
        SQWorkDetailsModelData * dataModel = model;
        
        self.lab_title.text = dataModel.sal_operation_link_text;
        
        if ([dataModel.sal_state isEqualToString:@"1"]) {//已完成
            self.lab_type.text = @"已完成";
            self.btn_check.hidden = YES;
            self.lab_type.textColor = [UIColor colorNamed:@"selColor"];
        }else if ([dataModel.sal_state isEqualToString:@"0"]){//未完成
            self.lab_type.text = @"未完成";
            self.btn_check.hidden = NO;
            self.lab_type.textColor = [UIColor colorNamed:@"ff00Color"];
        }
    }else if ([model isKindOfClass:SQSpecialRegionModelData.class]){
        
        SQSpecialRegionModelData * dataModel = model;
        
        self.lab_title.text = dataModel.sr_name;
        
        if ([dataModel.srp_state isEqualToString:@"1"]) {//已完成
            self.lab_type.text = @"已完成";
            self.btn_check.hidden = YES;
            self.lab_type.textColor = [UIColor colorNamed:@"selColor"];
        }else if ([dataModel.srp_state isEqualToString:@"0"]){//未完成
            self.lab_type.text = @"未完成";
            self.btn_check.hidden = NO;
            self.lab_type.textColor = [UIColor colorNamed:@"ff00Color"];
        }
    }
    
    
    
}
- (IBAction)clickCheck:(UIButton *)sender {
    self.cellEvent((int)self.indexPath.row);
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
